package com.authenticateCenter.mapper;

import com.authenticateCenter.domain.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.common.mybaits.CustomPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 大忽悠
 * @since 2022年10月08日
 */
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select role.* from role inner join user_role ur on ur.rid=role.id " +
            "where uid=#{uid} limit (#{page.pageNum}-1)*#{page.pageSize},#{page.pageSize}")
    List<Role> getRolesByUidWithPage(@Param("uid") Integer uid, @Param("page") CustomPage customPage);

    @Select("select role.* from role inner join user_role ur on ur.rid=role.id " +
            "where uid=#{uid}")
    List<Role> getRolesByUid(@Param("uid")Integer uid);
}

